<?php

namespace App\GameChannel\Sdks;

use App\GameChannel\LoginNotify;
use App\GameChannel\PayNotify;
use App\GameChannel\SdkBase;
use App\Models\Orders;
use App\Services\SdkService;
use Illuminate\Http\Request;

// 聚合端sdk
// 只需要处理登录和创单逻辑即可，支付成功回调将由 switch_pay 逻辑进行处理和最终发货
class Juheh5Sdk extends SdkBase
{
    public function login(Request $request): LoginNotify
    {
        $notify = $this->loginNotify;

        $openid         = $request->input('openid');
        $notify->openid = $openid;

        return $notify;
    }

    public function payInit(Orders $order, Request $request)
    {
        $data = [
            'pay_url' => $this->switchPayUrl($order),
        ];

        return $data;
    }
}
